/****************************************************************
 *  This file created by writerB.php on 03/08/2007 at 14:36:22  *
 ****************************************************************
 *  writerB.php created by Tonk (tonk@ctonk.com) in 2007        *
 ****************************************************************
 *                 General Document Information
 *
 *  File Name: exit.h
 *  Class Name: Exit
 *  Parent Classes: none
 *  Data members: 5
 *  Notes:
 ****************************************************************/

#ifndef __H_EXIT
#define __H_EXIT

#include <iostream>
#include <fstream>



class Exit {
	protected:
		// Protected data...
		int			_ExitID;	// Holds a unique value for every instantiation.
		unsigned	_vnum;		// Non-negative
		int			_point;		// Non-negative
		int			_key;		// Non-negative
		unsigned 	_flags;

		// Protected methods...
		void	setExitID( const int& ExitID );

	public:
		// Constructors...
		Exit();
		Exit( const Exit& );	// Doesn't change _ExitID
		~Exit();

		// Operators...
		Exit& operator = ( const Exit& );		// Doesn't change _ExitID
		bool operator == ( const Exit& ) const;	// Doesn't compare _ExitIDs
		bool operator < ( const Exit& ) const;	// Compares _ExitIDs
		bool operator > ( const Exit& ) const;	// Compares _ExitIDs

		// Public accessor methods...
		int			getExitID( void ) const;
		void		setVnum( const unsigned& vnum );
		unsigned	getVnum( void ) const;
		void		setPoint( const unsigned& point );
		unsigned	getPoint( void ) const;
		void		setKey( const unsigned& key );
		unsigned	getKey( void ) const;
		void		setFlags( const unsigned& flags );
		unsigned	getFlags( void ) const;
		void		setThere( const bool& there );
		bool		getThere( void ) const;
		void		setDoor( const bool& door );
		bool		getDoor( void ) const;
		void		setOpen( const bool& open );
		bool		getOpen( void ) const;
		void		setLock( const bool& lock );
		bool		getLock( void ) const;
		void		setLocked( const bool& locked );
		bool		getLocked( void ) const;

		// General methods...
		void	Save( std::ofstream& );
		void	Load( std::ifstream& );

		// Static members and methods...
		static int	exitIndex;	// Used to create a unique id for every Exit object
		static int	numExits;	// Keeps track of the total number of Exit objects
		static std::string direction2string( const unsigned& direction );
		static unsigned string2direction( const std::string& direction );
		static unsigned inverse( const unsigned& direction );
};

// Associated operators...
std::ostream& operator << ( std::ostream& write, Exit& exit );
std::ostream& operator << ( std::ostream& write, Exit* exit );
std::istream& operator >> ( std::istream& read, Exit& exit );
std::istream& operator >> ( std::istream& read, Exit* exit );



#endif // __H_EXIT
